In [1]:
from simpleazure import SimpleAzure as saz
In [2]:
azure = saz()
azure.asm.get_config()
Note.
get_config() includes cert.getSubscription() and cert.getManagementCertFile().
In IPython Notebook, adding ? or ?? to the end of a function name provides docstrings and source code on a hidden cell like below.
In [6]:
azure.asm.get_config?
In [ ]:
result = azure.asm.create_vm()
In [7]:
vars(azure.asm.get_status())
Out[7]:
If the status above indicates 'Succeeded', your request has been successfully accepted and Window Azure is working on deploying the virtual machine.
In [6]:
vars(azure.asm.get_deployment())
Out[6]:
If you see 'status' is Running, your virtual machine is ready to use. You can access to the machine via SSH.
Note.
azure.asm.create_vm() contains several sdk functions like as follows:
sms = ServiceManagementService(subscription_id, certificate_path)
sms.create_hosted_service(service_name=name, label=name, location=location)
linux_config = LinuxConfigurationSet(name, linux_user_id, linux_user_passwd, False)
linux_config.ssh.public_keys.public_keys.append(publickey)
linux_config.ssh.key_pairs.key_pairs.append(keypair)
network = ConfigurationSet()
network.configuration_set_type = 'NetworkConfiguration'
network.input_endpoints.input_endpoints.append(ConfigurationSetInputEndpoint('ssh', 'tcp', '22', '22'))
cert_res = sms.add_service_certificate(service_name=name, data=cert_data, certificate_format=cert_format, password=cert_password)
result = sms.create_virtual_machine_deployment(service_name=name, deployment_name=name, deployment_slot='production', label=name, role_name=name, system_config=linux_config, os_virtual_hard_disk=os_hd, network_config=network, role_size='Small')
If you want to see the current implementation,
azure.asm.create_vm?? below will diplay the source code of the function in IPython Notebook.
In [8]:
azure.asm.create_vm??
In [8]:
azure.asm.create_cluster(num=4)
There are other functions to utilize virtual machine images from the communnity (VM DEPOT) and communicate master and engine node(s) of clusters.
Other tutorials will explain how to use the other functions.